<?php

class productTaskModule extends Module {
	/*
	 * 在构造函数中装载所依赖的类或其他文件
	*/
	function __construct() {
		$this->includePhp('productTask', 'productTask');
	}
	
	/*
	 * 调用插件资源
	*/
	public function call($user, $method, $param) {
		//检查用户
		switch ($method) {
			case "index":
				productTask::index($param);
				break;
			case "getIndex":
				$status = $param->status;
				$start = $param->start;
				$limit = $param->limit;
			    productTask::getIndex($status,$start,$limit);
			    break;
			case 'checkpointBegin':
				$id = $param->id;
				if(!isset($id)){
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				productTask::checkpointBegin($id);
				break;
			case 'getAllProgress':
				$id = $param->id;
				if(!isset($id)){
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				productTask::getAllProgress($id);
				break;
			case 'getProgressInfo':
				$taskId = $param->taskId;
				$progressId = $param->progressId;
				if(!isset($taskId)||!isset($progressId)){
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				productTask::getProgressInfo($taskId,$progressId);
				break;
			case 'sendMessage':
				$taskId = $param->taskId;
				$progressId = $param->progressId;
				$type = $param->type;
				$content = $param->content;
				$voiceTime = $param->voiceTime;
				if(!isset($taskId)||!isset($progressId)||!isset($type)||!isset($content)){
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				productTask::sendMessage($taskId,$progressId,$type,$content,$voiceTime);
				break;
			case 'deletedMssage':
				$id = $param->id;
				if(!isset($id)){
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
				productTask::deletedMssage($id);
				break;
		}
	}
}


$module = new productTaskModule();
Module::addModule($module);
?>